<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>

  	<!--<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="no-cache">
<meta http-equiv="Pragma" content="no-cache">
	<meta http-equiv="expires" content="0"> -->
  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  <?php require_once("config.php"); ?>
  <title><?=TITLE_MAP?></title>
  <script src="js/phpFunctions.js" type="text/javascript"></script>

  <script src="js/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
  <script src="js/jshashtable.js" type="text/javascript"></script>
  <script src="js/jquery/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
  <script src="js/jquery/jquery.simplemodal-1.3.5.js" type="text/javascript"></script>

  <script language="javascript" src="js/MMapSidebars/monitor.js"></script>
  <script src="js/cookie.js" type="text/javascript"></script>
  <script src="js/utils.js" type="text/javascript"></script>

  <link href="styles/tablero.css"  rel="stylesheet" type="text/css"/>
  <link type="text/css" href="js/jquery/css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
 
  <?php if(DEBUG_MODE == 0){ ?>
  <script type="text/javascript">
  	  ctrl_FirebugActive();
  </script>
  <?php } ?>
  <?php
  // require_once('MAPS/'.$_GET['mapType'].'/header.php');
  	require_once('MAPS/header.php');
  ?>
  <style type="text/css">
		.toggler { width: 500px; height: 200px; position: relative;}
		#button { padding: .5em 1em; text-decoration: none; }
		#effect { width: 240px;  padding: 1em;  font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
		#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
  body {
    margin: 0;
    padding: 0;
    text-align: center;
	background: #E5E5E5 url(images/pageBG.jpg) repeat-x;
	overflow:hidden;
	}
  </style>
  <?php
  		require_once ("utils.php");
	  	require_once(ROOT_DIR_CLASES.'/cCliente.php');
  		require_once(ROOT_DIR_CLASES.'/log.php');
  		require_once(ROOT_DIR_CLASES.'/posiMovil.php');
		require_once(ROOT_DIR_CLASES.'/cLogin.php');
		require_once(ROOT_DIR_CLASES.'/PHPLogger.php');
  		require_once('JSON.php');

  	if (!isset($_SESSION['cliente'])) {
  		log::errorJS('Sesion expirada...');
  		exit();
  	}

	$LOGIN = unserialize($_SESSION['loginClass']);
	$json = new Services_JSON();
	$loginJSON = $json->encode($LOGIN);
	$LOGGER = new PHPLogger(LOGGER_PATH, LOGGER_LEVEL);

	/************************************************************************
	CONFIGURACION INICIAL
	*************************************************************************/
		//include("config.php");
		require_once(ROOT_DIR_CLASES.'/cResultado.php');
		require_once(ROOT_DIR_CLASES.'/cConfiguracion.php');
  		require_once(ROOT_DIR_CLASES.'/MiConfig.php');
		$cta 		= $LOGIN->cuentaFk;
		$iObjetivo 	= $LOGIN->objetivoDB;
		$esFlota 	= '0';

		$cantMapas = COUNT_MAP_DEFAULT;
		if ($LOGIN->objetivoDB == 3){
			$esFlota = '1';
		}
		if ($LOGIN->objetivo == 4){
			$cta = $LOGIN->tablaId;
			$iObjetivo = $LOGIN->objetivo;
		}

		$configRegistrada = cConfiguracion::getConfig($cta, $iObjetivo);
		$miConfig = new MiConfig();
		//Puntos
		$puntosVisibles = cConfiguracion::getPuntosVisibles($cta, $iObjetivo);
		for($i = 0;  $i < $puntosVisibles->cantidad(); $i++ ) {
			$miConfig->putPuntoId($puntosVisibles->campo('PUNTO_ID',$i));
		}
		//Zonas
		$zonasVisibles = cConfiguracion::getZonasVisibles($cta, $iObjetivo);
		for($i = 0;  $i < $zonasVisibles->cantidad(); $i++ ) {
			$miConfig->putZonaId($zonasVisibles->campo('ZONA_ID',$i));
		}

		if ($configRegistrada->cantidad()>0){ //tiene configuracion inicial
			$miConfig->id = $configRegistrada->campo('ORDER_ID',0);
			//Vehiculo
			$miConfig->VEHlblformat = $configRegistrada->campo('VEH_lblformat',0);
			if (trim($miConfig->VEHlblformat)=='')
				$miConfig->VEHlblformat = VEH_LBLFORMAT;
			$miConfig->CMDtimeout = $configRegistrada->campo('CMD_timeout',0);
			if (trim($miConfig->CMDtimeout)=='')
				$miConfig->CMDtimeout = CMD_TIMEOUT;

			$miConfig->VEHsimpleview = $configRegistrada->campo('VEH_simpleview',0);
			if (trim($miConfig->VEHsimpleview)=='')
				$miConfig->VEHsimpleview = VEH_SIMPLEVIEW;
			$miConfig->VEHlblmapformat = $configRegistrada->campo('VEH_lblmapformat',0);
			if (trim($miConfig->VEHlblmapformat)=='')
				$miConfig->VEHlblmapformat = VEH_LBLMAPFORMAT;
			$miConfig->VEHlblcolor = $configRegistrada->campo('VEH_lblcolor',0);
			if (trim($miConfig->VEHlblcolor)=='')
				$miConfig->VEHlblcolor = VEH_LBLCOLOR;
			$miConfig->VEHlblsize = $configRegistrada->campo('VEH_lblsize',0);
			if (trim($miConfig->VEHlblsize)=='')
				$miConfig->VEHlblsize = VEH_LBLSIZE;
			$miConfig->VEHradio = $configRegistrada->campo('VEH_radio',0);
			if (trim($miConfig->VEHradio)=='')
				$miConfig->VEHradio = VEH_RADIO;
			$miConfig->VEHtransparencia = $configRegistrada->campo('VEH_transparencia',0);
			if (trim($miConfig->VEHtransparencia)=='')
				$miConfig->VEHtransparencia = VEH_TRANSPARENCIA;

			//Historico
			$miConfig->HIScolor = $configRegistrada->campo('HIS_color',0);
			if (trim($miConfig->HIScolor)=='')
				$miConfig->HIScolor = HIS_COLOR;
			$miConfig->HISthickness = $configRegistrada->campo('HIS_thickness',0);
			if (trim($miConfig->HISthickness)=='')
				$miConfig->HISthickness = HIS_THICKNESS;
			$miConfig->HISversentido = $configRegistrada->campo('HIS_sentido',0);
			if (trim($miConfig->HISversentido)=='')
				$miConfig->HISversentido = HIS_VERSENTIDO;
			$miConfig->HISvelexceso = $configRegistrada->campo('HIS_exceso',0);
			if (trim($miConfig->HISvelexceso)=='')
				$miConfig->HISvelexceso = HIS_VELEXCESO;
			$miConfig->HISfiltrocero = $configRegistrada->campo('HIS_filtrocero',0);
			if (trim($miConfig->HISfiltrocero)=='')
				$miConfig->HISfiltrocero = HIS_FILTROCERO;
				
				
			$miConfig->FIJsimpleview = $configRegistrada->campo('FIJ_simpleview',0);
			if (trim($miConfig->FIJsimpleview)=='')
				$miConfig->FIJsimpleview = FIJ_SIMPLEVIEW;
			$miConfig->FIJlblmapformat = $configRegistrada->campo('FIJ_lblmapformat',0);
			if (trim($miConfig->FIJlblmapformat)=='')
				$miConfig->FIJlblmapformat = FIJ_LBLMAPFORMAT;
			$miConfig->FIJlblcolor = $configRegistrada->campo('FIJ_lblcolor',0);
			if (trim($miConfig->FIJlblcolor)=='')
				$miConfig->FIJlblcolor = FIJ_LBLCOLOR;
			$miConfig->FIJlblsize = $configRegistrada->campo('FIJ_lblsize',0);
			if (trim($miConfig->FIJlblsize)=='')
				$miConfig->FIJlblsize = FIJ_LBLSIZE;
			$miConfig->FIJradio = $configRegistrada->campo('FIJ_radio',0);
			if (trim($miConfig->FIJradio)=='')
				$miConfig->FIJradio = FIJ_RADIO;
			$miConfig->FIJtransparencia = $configRegistrada->campo('FIJ_transparencia',0);
			if (trim($miConfig->FIJtransparencia)=='')
				$miConfig->FIJtransparencia = FIJ_TRANSPARENCIA;
		}else{ //no tiene configuracion inicial .:. levanto la configuracion por defecto...
			$miConfig->id = '';
			//Vehiculo
			$miConfig->VEHlblformat = VEH_LBLFORMAT;
			$miConfig->CMDtimeout = CMD_TIMEOUT;
			$miConfig->VEHsimpleview = VEH_SIMPLEVIEW;
			$miConfig->VEHlblmapformat = VEH_LBLMAPFORMAT;
			$miConfig->VEHlblcolor = VEH_LBLCOLOR;
			$miConfig->VEHlblsize = VEH_LBLSIZE;
			$miConfig->VEHradio = VEH_RADIO;
			$miConfig->VEHtransparencia = VEH_TRANSPARENCIA;
			//Historico
			$miConfig->HIScolor = HIS_COLOR;
			$miConfig->HISthickness = HIS_THICKNESS;
			$miConfig->HISversentido = HIS_VERSENTIDO;
			$miConfig->HISvelexceso = HIS_VELEXCESO;
			$miConfig->HISfiltrocero = HIS_FILTROCERO;
			
			$miConfig->FIJsimpleview = FIJ_SIMPLEVIEW;
			$miConfig->FIJlblmapformat = FIJ_LBLMAPFORMAT;
			$miConfig->FIJlblcolor = FIJ_LBLCOLOR;
			$miConfig->FIJlblsize = FIJ_LBLSIZE;
			$miConfig->FIJradio = FIJ_RADIO;
			$miConfig->FIJtransparencia = FIJ_TRANSPARENCIA;
		}
	/****************************************************************************/
  ?>

    <!-- CLASES MY -->
    <script src="js/jshashtable.js" type="text/javascript"></script>
    <script src="js/myClass/MyClass.js" type="text/javascript"></script>
    <script src="js/myClass/MyLibraryManager.js" type="text/javascript"></script>


    <!-- DINAMIC INCLUDES CLASS -->
    <link href="js/progressBar/styles/ProgressBar.css" rel="stylesheet" type="text/css" />
    <script src="js/progressBar/ProgressBar.js" type="text/javascript"></script>
    <script src="js/DinamicIncludes_Map.js" type="text/javascript"></script>
	<!-- DHTMLCOMBO -->
    <link href="js/dhtmlcombo/dhtmlcombo.css" rel="stylesheet" type="text/css" />
    <script src="js/dhtmlcombo/dhtmlcombo.js" type="text/javascript"></script>
    <!-- -------------------------------------------------------------------------------------------------------------------------------- -->
    <script type="text/javascript">
    AVL_BOUNDS = <?=AVL_BOUNDS?>;
    AVL_SCALES_LIST = <?=AVL_SCALES_LIST?>;
	callesUrl 	= "http://<?=AVL_MAP_SERVER_IP?>:<?=AVL_MAP_SERVER_PORT?>/mapguide/mapagent/mapagent.fcgi?USERNAME=<?=AVL_MAP_SERVER_ADMIN?>&PASSWORD=<?=AVL_MAP_SERVER_PASSW?>&";
    callesParams= {
    	mapdefinition: '<?=AVL_MAP_DEFINITION?>',
    	basemaplayergroupname: "<?=AVL_MAP_BASE_LAYER_GROUP?>"
    }
    callesOptions = {
    	singleTile: false
    }

    IntroducirCookie('wcMapType', '<?=$_GET['mapType']?>');
	var LOGIN 				= null;
    var cantMapas 			= <?=COUNT_MAP_DEFAULT?>;
    var cantMAXMaps		 	= <?=COUNT_MAP_MAX?>;
    var vMaps				= new Array();
	var vMapsDivs 			= new Array();
    var map 				= null;
    var cMapController;
    var MOVILES_VISIBLES 	= null;
    var FIJOS_VISIBLES		= null;

    var indiceMapaActivo 	= 0;

	var defaultEvents = null; //control de eventos por defecto para el mapa.
	var vDefaultsEvents = new Array();
    var metersPerUnit = 111319.4908;  //value returned from mapguide
    var inPerUnit = null;
	var mapIcons = null;
    /**/
	//var mapEventsHandlers = new Hashtable(); //Hashtable con Handlers de los eventos del mapa
	//var mapEventsFunctions = new Hashtable(); //Hastable con funciones de los Handlers de los eventos del mapa

	var mapActiveCursor = 'default';
    var AccordionMenu = null;
	var PopUpMenuMap = null;
    var READY_STATE_UNINITIALIZED 	= 0;
	var READY_STATE_LOADING 		= 1;
	var READY_STATE_LOADED 			= 2;
	var READY_STATE_INTERACTIVE 	= 3;
	var READY_STATE_COMPLETE 		= 4;
	var NOT_BUSY_IMAGE = "/images/loader_inactive.gif";
	var BUSY_IMAGE = "/images/loader_pulse.gif";

	var properties = null;
	var cuentaSelectSegui = <?="'".$_GET['cuentaSelectSegui']."'"?>;
	var cuentaSelectTablero = '-1';
	<? if (isset($_GET['cuentaSelectTablero'])) {?>
		 cuentaSelectTablero = <?="'".$_GET['cuentaSelectTablero']."'"?>
	<? } ?>;

	/*Convertir constantes PHP a JS*/
	var GEO_PROVINCIA = <?="'".GEO_PROVINCIA."'"?>;
	var GEO_CIUDAD = <?="'".GEO_CIUDAD."'"?>;
	var GEO_PAIS = <?="'".GEO_PAIS."'"?>;

	var VEH_LBLFORMAT = <?="'".$miConfig->VEHlblformat."'" ?>;
	var CMD_TIMEOUT = <?= $miConfig->CMDtimeout ?>;

	var VEH_SIMPLEVIEW = <?=$miConfig->VEHsimpleview ?>;
	var VEH_LBLMAPFORMAT = <?="'".$miConfig->VEHlblmapformat."'" ?>;
	var VEH_LBLCOLOR = <?="'#".$miConfig->VEHlblcolor."'" ?>;
	var VEH_LBLSIZE = <?="'".$miConfig->VEHlblsize."px'" ?>;
	var VEH_RADIO = <?=$miConfig->VEHradio ?>;
	var VEH_TRANSPARENCIA = <?=$miConfig->VEHtransparencia ?>;

	var FIJ_SIMPLEVIEW 	= <?=$miConfig->FIJsimpleview ?>;
	var FIJ_LBLFORMAT 	= <?="'".$miConfig->FIJlblformat."'" ?>;
	var FIJ_LBLMAPFORMAT= <?="'".$miConfig->FIJlblmapformat."'" ?>;
	var	FIJ_LBLCOLOR 	= <?="'#".$miConfig->FIJlblcolor."'" ?>;
	var FIJ_LBLSIZE 	= <?="'".$miConfig->FIJlblsize."px'" ?>;
	var FIJ_RADIO 		= <?=$miConfig->FIJradio ?>;
	var FIJ_TRANSPARENCIA = <?=$miConfig->FIJtransparencia ?>;
	
	var COLOR_DEFAULT_RECORRIDO_INI = <?= "'".COLOR_DEFAULT_RECORRIDO_INI."'" ?>;
	var COLOR_DEFAULT_RECORRIDO_FIN = <?= "'".COLOR_DEFAULT_RECORRIDO_FIN."'" ?>;

	var MOVILES_SELECCIONADOS = "";
	var FIJOS_SELECCIONADOS = "";
	
	var misVehiculos_limitView = <?= LIMIT_VIEWMOVILES ?>;
	var misVehiculos_limitMonitor = <?= LIMIT_LISTMONITOR ?>;
	var misVehiculos_loteo = <?= LOTE_MOVILES ?>;
	
	var misFijos_limitView = <?= LIMIT_VIEWMOVILES ?>;
	var misFijos_loteo = <?= LOTE_MOVILES ?>;

	var MAXMOVILCERCA = <?= MAXMOVILCERCA ?>;

	<?php
	if (isset($_GET['movilesSELECTED'])) {?>
		MOVILES_SELECCIONADOS = <?="'".$_GET['movilesSELECTED']."'"?> ;
	<? } ?>;
	var MOVILES_MONITOR = "";

	<?php if (isset($_GET['movilesMONITOR'])) {?>
		MOVILES_MONITOR = <?="'".$_GET['movilesMONITOR']."'"?> ;
	<?php } ?>;

	//var MOVILES_VISIBLES = cuentaSelectSegui;


	var PERMISOS_BYKOM = new Array(0,0,0,0,0);
	var OPENER_BYKOM = 0;
	<?php if (($LOGIN->isBykom)&&(isset($permisosBykomString))) {?>
	    OPENER_BYKOM = 1;
		PERMISOS_BYKOM = new Array();
		var arrayStrValues = '<?=$permisosBykomString ?>';
		for (var i=0; i < arrayStrValues.length; i++){
			PERMISOS_BYKOM.push(arrayStrValues.substr(i,1));
			}
	<?php } ?>;

	var movilHIS = null;
	<?php if (isset($_GET['movilHIS'])) {?> movilHIS = <?="'".$_GET['movilHIS']."'"?> <? } ?>;
	var desdeHIS = null;
	<?php if (isset($_GET['desdeHIS'])) {?> desdeHIS = <?="'".$_GET['desdeHIS']."'"?> <? } ?>;
	var hastaHIS = null;
	<?php if (isset($_GET['hastaHIS'])) {?> hastaHIS = <?="'".$_GET['hastaHIS']."'"?> <? } ?>;

	var COLOR_DEFAULT_ZONA_GMAP = '<?= $miConfig->HIScolor; ?>';
	var PUNTOSVISIBLES_string = '<?= join(",", $miConfig->PUNTOSVISIBLESid); ?>';
	var ZONASVISIBLES_string = '<?= join(",", $miConfig->ZONASVISIBLESid); ?>';

	/*FLAGS*/
	var autoRefreshFlag = 0;
	var monitorActivoFlag = false;
	var vehiculosCargadosFlag = false;

/****************************(REFRESH)********************************/

	function OnReadyStateChange() {
    	var ready = reqHandler.readyState;
		if (ready == READY_STATE_COMPLETE) {
			<?php if(DEBUG_MODE == 0){ ?>
			//controlo que firebug no este activo
				ctrl_FirebugActive();
			<?php } ?>
			//si los vehiculos aun no estan cargados en su hash reintento cargarlos...
			if (misVehiculosHash.isEmpty()){
				CargarMisVehiculos();
			}
			//si los fijos aun no estan cargados en su hash reintento cargarlos...
			if(LOGIN.objetivoDB==5){
				if (misFijosHash.isEmpty()){
					CargarMisFijos();
				}
			}
			//refresh POSICIONES DE VEHICULOS
			results = jQuery.parseJSON(reqHandler.responseText);
			if (results.length != 'undefined') {
				var resultsLarge = results.length;
				if(LOGIN.PERMISOS[10]){ //chat habilitado
					resultsLarge = results.length - 1;
				}

				for (var i = 0; i < resultsLarge; i++) {
					var movilAnterior = misVehiculosHash.get(results[i].id);
					if (movilAnterior != null){
						var latitud = 0;
						var longitud = 0;
						if (movilAnterior.POSIMOVIL != null) {
							latitud =  movilAnterior.POSIMOVIL.latitud;
							longitud = movilAnterior.POSIMOVIL.longitud;
						}
						misVehiculosHash.get(results[i].id).POSIMOVIL = results[i];
						if (latitud != results[i].latitud || longitud != results[i].longitud) {
							if (VEH_SIMPLEVIEW){
								cMapController.refreshPosicSimpleViewMovilMaps(results[i].id)//refresco cada mapas con la posicion del movil si esta visible en el mismo
							}else{
					/*TODO:*/	//cMapController.refreshPosicMovilMaps(results[i].id)//refresco cada mapas con la posicion del movil si esta visible en el mismo
								cMapController.getMapActive().putIconCar(results[i].id);
							}
						}
					}
				}
				if (LOGIN.PERMISOS[10]){
					if(results[resultsLarge]>0){ //EXISTEN MENSAJES EN CHAT ALIVE!
						document.getElementById('alertChatIncomming').title='Usted tiene '+results[resultsLarge-1]+' mensajes sin leer en Chat Live!';
						document.getElementById('alertChatIncomming').style.display = "block";
					   }
					else document.getElementById('alertChatIncomming').style.display = "none";
				}
				//refreshViewMisVehiculos();
			}

			//refresh panel SEGUIMIENTO
			refreshMovilSeguimiento();
			//refresh panel SELECCION
			refreshMovilSelection();
			//refresh TABLERO
			if ((LOGIN.PERMISOS[12])&& ($j("#tablero_content").css("display")=="block")){
				refreshMovilTablero();
			}

			//refresh eventos en MONITOR
			if ((vehiculosCargadosFlag)&&(LOGIN.PERMISOS[1])){
				CargarEventosMonitor();
			}

			document.getElementById("busyImg").style.visibility = "hidden";
			autoRefreshFlag = 0;
			reqHandler = null;
		}
    }

	function RefreshForm() {
		if ((!vehiculosCargadosFlag)||(autoRefreshFlag==1)) return;
    	autoRefreshFlag = 1;
    	document.getElementById("busyImg").style.visibility = "visible";
		var reqParamsRefreshForm = "COMMAND=REFRESH";
	//	reqParamsRefreshForm += "&cuentas=" + vehiculosVisiblesId.join(",");
		reqParamsRefreshForm += "&cuentas=" +cMapController.getVehiculosVisiblesGral().join(",");
		if(LOGIN.PERMISOS[10]){ //chat habilitado
			reqParamsRefreshForm += "&TABLAID="+LOGIN.tablaId;
			reqParamsRefreshForm += "&OBJETIVO="+LOGIN.objetivo;
		}
    	if (msie)
            reqHandler = new ActiveXObject("Microsoft.XMLHTTP");
        else
            reqHandler = new XMLHttpRequest();
        reqHandler.onreadystatechange = OnReadyStateChange;
        reqHandler.open("POST", "querycontroller.php", true);
        reqHandler.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		reqHandler.send(reqParamsRefreshForm);
    }

	function AutoRefreshForm() {
    	if (autoRefreshFlag == 0) {
    		RefreshForm();
    	}
    }

	var menuVisible = true;
	function collapseMenuBar(){
		mapWidth = mapCanvas.offsetWidth;
		if (menuVisible){
			accordionWidth = document.getElementById('AccordionMenu').offsetWidth;
			document.getElementById('sliceMenuBarIcon').className = 'sliceMenuBarIconIn';
			menuVisible = false;
			document.getElementById('gMapMenuBar').style.width='10px';
			document.getElementById('AccordionMenu').style.display = "none";
			document.getElementById('gMapMainContent').style.marginRight ='18px';
		}
		else{
			document.getElementById('sliceMenuBarIcon').className = 'sliceMenuBarIconOut';
			menuVisible = true;
			document.getElementById('gMapMenuBar').style.width='325px';
			document.getElementById('AccordionMenu').style.display = "block";
			document.getElementById('gMapMainContent').style.marginRight = '333px';
		}
		for(var i=0;i<cantMapas;i++){
			cMapController.getMapById(i).getMap().updateSize();
		}

		if ((tableroContainer != null)&&(tableroContainer.isVisible)){
			//tableroContainer.redraw();
		}
		refreshMapMainContent();
		refreshMonitor();
		refreshTablero();
	}

	var toMapType = '<?= $_GET['mapType']?>';
	function changeMapServer(mapType){
		toMapType = mapType;
		for(var i=0;i<cantMapas;i++){
			var centerLonLat = cMapController.getMapActive().getMap().getCenter().transform(projection, displayProjection);
		}
		//var centerLonLat = map.getCenter().transform(projection, displayProjection);
		var URL = "map.php?v=" + <?="'".$_GET['v']."'"?> + "&cuenta=" + <?="'".$_GET['cuenta']."'"?> + "&cuentaSelectSegui=" + cuentaSelectSegui + "&cuentaSelectSelection=" + cuentaSelectSelection + "&cuentaSelectTablero=" + cuentaSelectTablero + "&y=" + centerLonLat.lon + "&x=" + centerLonLat.lat + "&mapType=" + mapType;
		var URLmoviles = '&movilesSELECTED='+vehiculosSeleccionadosId.toString();
		URLmoviles += '&movilesMONITOR='+vehiculosMonitoreadosId.toString();
		URLmoviles += '&movilesVISIBLES='+vehiculosVisiblesId.toString();

		var URLhistorico = "&movilHIS=" + document.getElementById('cuentaSelectHistorico').value;
		URLhistorico += "&desdeHIS=" + document.getElementById('fechaInicio').value;
		URLhistorico += "&hastaHIS=" + document.getElementById('fechaFin').value;
		if (OPENER_BYKOM == 1) {
			URL = "mapBykom.php?ORDERID=<?=$_REQUEST['ORDERID']?>&ESFLOTA=<?=$_REQUEST['ESFLOTA']?>&cuentaSelectSegui=<?=$_REQUEST['cuentaSelectSegui']?>&mapType=" + mapType +"&PUBLICKEY=<?=$_REQUEST['PUBLICKEY']?>&USUARIOID=<?=$_REQUEST['USUARIOID']?>&y=<?=$_GET['y']?>&x=<?=$_GET['x']?>";
			URLmoviles = "";
			URLhistorico = "";
		}
		/*var reloadpage = "changemap_ie.php?urlreload="+escape(URL + URLmoviles + URLhistorico);
			self.location.href = reloadpage;*/
		if (msie)
			window.opener.refreshPopUpMapa(URL + URLmoviles + URLhistorico);
		else
			self.location.href = URL + URLmoviles + URLhistorico;
	}

	function closeOrRefreshMap(evt, mapType){
		if (msie){
			var e = (window.event) ? window.event : evt;
			if (e.clientX < 0 || e.clientY < 0){
				return;
			}
			else{
				changeMapServer(toMapType);
			}
		}
		unload();
	}


    </script>



  </head>
  <body onload="loadlibraries();" onunload="closeOrRefreshMap(event);" onResize="resizear()">

  <div id="mapLoadingPanel" >
    	<table width="100%" height="100%" border="0"><tr><td align="center" valign="middle">
            <img border="0" src="images/loader.gif" /><br />
			<span style="color:#666666; font-size:9px; font-family:Verdana, Arial, Helvetica, sans-serif">CARGANDO...</span><br />
			<div id="mapLoadingBar" style="width:350px; height:40px;"></div>
        </td></tr></table>
  </div>

  <!-- DIVS PARA FUNCIONAMIENTO DEL DHTML WINDOW -->
  <div id="dhtmlwindowholder"><span style="display:none">.</span></div>
  <div id="interVeil"></div>
  <!-- ----------------------------------------- -->
    <style type="text/css">
		.buttonBARAddMapa {
		   width: 62px;
		   height: 54px;
		   background: no-repeat url('./images/toolbar/map_add.png');
		   }
		.buttonBARAlinearMapa {
		   width: 62px;
		   height: 54px;
		   background: no-repeat url('./images/toolbar/map_visualizacion2a.png');
		 }
		.buttonBARMaximizeMapa {
		   width: 62px;
		   height: 54px;
		   background: no-repeat url('./images/toolbar/maximizar2.png');
		   }
		.buttonBARMonitorMapa {
		   width: 64px;
		   height: 54px;
		   background: no-repeat url('./images/toolbar/map_monitor.png');
		   }
		.buttonBARSaveMapa {
		   width: 62px;
		   height: 54px;
		   background: no-repeat url('./images/toolbar/map_saveall.png');
		   }

   </style>
   <script>
		$j = jQuery.noConflict();

   		function setearImagenFromCantidadMapas() {
   			var imagen = document.getElementById('imgCantidadMapas');
   			var baseImg = "./images/toolbar/";
   			if (cantMapas == 1) {
   				imagen.src = baseImg + 'uno.png';
   			} else if (cantMapas == 2) {
   				imagen.src = baseImg + 'dos.png';
   			} else if (cantMapas == 3) {
   				imagen.src = baseImg + 'tres.png';
   			} else if (cantMapas == 4) {
   				imagen.src = baseImg + 'cuatro.png';
   			} else if (cantMapas == 5) {
   				imagen.src = baseImg + 'cinco.png';
   			} else if (cantMapas == 6) {
   				imagen.src = baseImg + 'seis.png';
   			}
   		}

   		function setearImagenBtnStyleFromCantidadMapas() {
   			var imagen = document.getElementById('imgBARAlinearMapa');
   			var baseImg = "./images/toolbar/";
   			if (cantMapas == 1) {
   				//imagen.src = baseImg + 'uno.png';
   			} else if (cantMapas == 2) {
   				if($j("#mapsAlign").val() == 1){
   					imagen.src= baseImg +  'map_visualizacion2b.png';
   				}else{
   					imagen.src = baseImg + 'map_visualizacion2a.png';
   				}
   			} else if (cantMapas == 3) {
   				if($j("#mapsAlign").val() == 1){
   					imagen.src = baseImg +  'map_visualizacion3b.png';
   				}else{
   					imagen.src = baseImg + 'map_visualizacion3a.png';
   				}
   			} else if (cantMapas == 4) {
   			//	imagen.src = baseImg + 'cuatro.png';
   			} else if (cantMapas == 5) {
   				if($j("#mapsAlign").val() == 1){
   					imagen.src = baseImg +  'map_visualizacion5b.png';
   				}else{
   					imagen.src = baseImg + 'map_visualizacion5a.png';
   				}
   			} else if (cantMapas == 6) {
   			//	imagen.src = baseImg + 'seis.png';
   			}
   		}
   		
   		function agregarMapa() {
   			if (cantMapas == 6) {
   				alert("Se alcanzo el maximo de mapas permitidos");
   			}
   			cantMapas = cantMapas+1;
   			setearImagenFromCantidadMapas();
   			var ultMap = cMapController.addMap(new cMapa());
   			ultMap--;	
   			$j("#map"+ultMap).css("display","block");
   			cMapController.getMapById(ultMap).initServers(ultMap);
			cMapController.getMapById(ultMap).initControls(ultMap);
			cMapController.getMapById(ultMap).setLonLat(new OpenLayers.LonLat(parseFloat(<?=$_GET['y']?>), parseFloat(<?=$_GET['x']?>)).transform(cMapController.getMapById(ultMap).getDisplayProjection(), cMapController.getMapById(ultMap).getProjection()));
			cMapController.getMapById(ultMap).getMap().setCenter(cMapController.getMapById(ultMap).getLonLat(), cMapController.getMapById(ultMap).getZoomInitialMap());
   			cMapController.initNewMap(ultMap);
			defaultDimensionsMaps(cantMapas);
			setearImagenBtnStyleFromCantidadMapas();
   		}
   </script>
  <div id="gMapContainer" style="visibility:hidden;">
    <div id="gMapHeader" style="width:100%;">
    	<table id="map_selector_table" cellpadding="0" cellspacing="0" border="0" width="100%" height="58">
    	<tr>
           <td style="margin-left: 10px;">
           	 <div id="toolBarTop">
           	 <table>
           	 <tr>
           	 	<td>
           	 		<img src="./images/toolbar/tres.png" id="imgCantidadMapas"/>
           	 	</td>
           	 	<td>
           	 		<button class="buttonBARAddMapa" type="button" onclick="agregarMapa();"/>
           	 	</td>
           	 	<td>
           	 		<input type="hidden" name="mapsAlign" id="mapsAlign" value="2">
           	 		<!-- <button id="btnBARAlinearMapa" class="buttonBARAlinearMapa" type="button" onclick="AlinearMapas();setearImagenBtnStyleFromCantidadMapas();"/>--> 
           	 		 <img id="imgBARAlinearMapa"  src="./images/toolbar/map_visualizacion2a.png"   onclick="AlinearMapas(); setearImagenBtnStyleFromCantidadMapas();"/>
           	 	</td>
           	 	<td>
           	 		<button id="btnMaxMinMap" class="buttonBARMaximizeMapa" type="button" onclick="MaxMinMaps();"/>
           	 	</td>
           	 	<td>
           	 		<button class="buttonBARMonitorMapa" type="button" onclick="collapseMonitor();"/>
           	 	</td>
           	 	<td>
           	 		<button id="btnGuardar" class="buttonBARSaveMapa" type="button" onclick="Guardar();"/>
           	 	</td>
           	 </div>
           </td>
           <td width="300px" align="rigth">
            	<?php if ($LOGIN->isPRO){ ?>
            	<div style="height:58px; width:300px; background:url(imagenes/logomapsPro.jpg) center no-repeat; float:right; text-align:right;">
                <?php } else { ?>
				<div style="height:58px; width:300px; background:url(imagenes/logomaps.jpg) center no-repeat; float:right; text-align:right;">
                <?php } ?>
                	<div style="width:100%; height:20px;"><img id="busyImg" src="images/loader_pulse.gif" style="vertical-align:bottom" align="right"></div>
                    <div style="width:100%"><img id="alertChatIncomming" src="images/chat/alertChatIncomming.gif" style="vertical-align:bottom; display:none;" align="right"></div>
                </div>
            </td>
        </tr>
        </table>
    </div>

    <div id="gMapMenuBar">

        <!-- DIV generico para crear el contenido de las ventanas DHTMLWindow -->
        <div id="genericDHTMLWindowDiv" style="display:none; text-align:left;" align="left"></div>
        <table cellpadding="0" cellspacing="0" border="0" height="100%" width="100%">
        <tr>
        <td width="10" valign="middle" align="center" style="background:#E3E3E3 url(images/collapsableBarBG.gif) repeat-y; cursor:pointer;" bgcolor="#FFC0C0" onClick="collapseMenuBar();" >
        	<div id="sliceMenuBarIcon" class="sliceMenuBarIconOut"></div>
        </td>
        <td valign="top">
 	    <div id="AccordionMenu" class="Accordion" tabindex="0">

	  	<?php
	  		if($LOGIN->objetivoDB == 5){
	  			include('GMapPanels/fijos.php');
	  		}
	  		include('GMapPanels/vehiculos2.php');
			include('GMapPanels/seguimiento.php');
			include('GMapPanels/seleccion.php');
			if($LOGIN->objetivo == 4){
				if($LOGIN->PERMISOSAlias[3]){
					include('GMapPanels/historico.php');
				}
			}else{
				include('GMapPanels/historico.php');
			}
			if ($LOGIN->PERMISOS[4])
				include('GMapPanels/mispuntos.php');
			if ($LOGIN->PERMISOS[5])
				include('GMapPanels/miszonas.php');
			if ($LOGIN->PERMISOS[6])
				include('GMapPanels/reglas.php');
			include('GMapPanels/miscelaneas.php');
		?>
		</div>
        </td>
        </tr>
        </table>
    </div>
    <style type="text/css">
    	.color-divNroMap{
    		background-color :#000000;
    		opacity: 1;
    		font-weight: bolder;
    		color: white;
    	}
     	.my_CSS3_id {
		  border: 1px solid #000;
		  -moz-box-shadow: 0 0 1em #0000FF;
		  -webkit-box-shadow: 0 0 1em #0000FF;
		  box-shadow: 0 0 1em  #0000FF;

 		}
 		.monitorShow{
 			position:absolute;
 			opacity:0.9;
 			height: 20%;
 		}
		#sortable { list-style-type: none; margin: 0; padding: 0; }
		#sortable li { margin: 3px 0px 3px 0; padding: 1px; float: left;  height:395px;  text-align: center; }
		
		#tabs { margin-top: 1em; }
		#tabs li {float:left; list-style: none;}
		#tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; }
	
	</style>
	<script type="text/javascript">

		function setFiltroHistoricoByMap(mapa){
			mapa.getHistorico().setMovil($j("#cuentaSelectHistorico").val());
			mapa.getHistorico().setFechaDesde($j("#fechaInicio").val());
			mapa.getHistorico().setFechaHasta($j("#fechaFin").val());
			mapa.getHistorico().setColor($j("#colorId").val());
			mapa.getHistorico().setAncho($j("#thickness").val());
			var sentido = 0;
			if($j("#verSentido").is(':checked')){
				sentido = 1;
			}
			mapa.getHistorico().setSentidoRecorrido(sentido);
			mapa.getHistorico().setExcesoVelocidad($j("#excesoVelocidad").val());
			mapa.getHistorico().setFiltrarVelocidad0($j("#filtrarCeros").val());
			mapa.getHistorico().setTiempoMinimoRecorrido($j("#tiempoParada").val());
		}
		function getFiltroHistoricoByMap(mapa){
			$j("#cuentaSelectHistorico").val(mapa.getHistorico().getMovil());
			$j("#fechaInicio").val(mapa.getHistorico().getFechaDesde());
			$j("#fechaFin").val(mapa.getHistorico().getFechaHasta());
			$j("#colorId").val(mapa.getHistorico().getColor());
			$j('#colorText').css("background","#"+mapa.getHistorico().getColor());
			//historicoChangeColor(mapa.getHistorico().getColor());
			$j("#thickness").val(mapa.getHistorico().getAncho());
			if(mapa.getHistorico().getSentidoRecorrido() == "1" ){
				$j("#verSentido").attr('checked', true);
			}else{
				$j("#verSentido").attr('checked', false);
			}
			$j("#excesoVelocidad").val(mapa.getHistorico().getExcesoVelocidad());
			$j("#filtrarCeros").val(mapa.getHistorico().getFiltrarVelocidad0());
			$j("#tiempoParada").val(mapa.getHistorico().getTiempoMinimoRecorrido());
		}
		//sets valores del filtro de eventos
		function setFiltroEventoByMap(mapa){
			mapa.getHistorico().setMovilEvento($j("#cuentaSelectHistoricoEvento").val());
			mapa.getHistorico().setFechaDesdeEvento($j("#fechaInicioHistoricoEventos").val());
			mapa.getHistorico().setFechaHastaEvento($j("#fechaFinHistoricoEventos").val());
			mapa.getHistorico().setEstadoEvento($j("#estadoHistoricoEventos").val());
		}
		function getFiltroEventoByMap(mapa){
			$j("#cuentaSelectHistoricoEvento").val(mapa.getHistorico().getMovilEvento());
			$j("#fechaInicioHistoricoEventos").val(mapa.getHistorico().getFechaDesdeEvento());
			$j("#fechaFinHistoricoEventos").val(mapa.getHistorico().getFechaHastaEvento());
			$j("#estadoHistoricoEventos").val(mapa.getHistorico().getEstadoEvento());
		}
		//sets valores del filtro de paradas
		function setFiltroParadasByMap(mapa){
			mapa.getHistorico().setMovilParadas($j("#cuentaSelectHistoricoParada").val());
			mapa.getHistorico().setFechaDesdeParadas($j("#fechaInicioHistoricoParadas").val());
			mapa.getHistorico().setFechaHastaParadas($j("#fechaFinHistoricoParadas").val());
			mapa.getHistorico().setTiempoDetenidoParadas($j("#tiempoHistoricoParadas").val());
		}
		function getFiltroParadasByMap(mapa){
			$j("#cuentaSelectHistoricoParada").val(mapa.getHistorico().getMovilParadas());
			$j("#fechaInicioHistoricoParadas").val(mapa.getHistorico().getFechaDesdeParadas());
			$j("#fechaFinHistoricoParadas").val(mapa.getHistorico().getFechaHastaParadas());
			$j("#tiempoHistoricoParadas").val(mapa.getHistorico().getTiempoDetenidoParadas());
		}

		function refreshMapMainContent(){
			var wWindow  = $j(window).width();
			var wMenuBar = $j('#gMapMenuBar').width();
			$j('#gMapMainContent').css("width", wWindow-wMenuBar-21);
		}

		function animateToDefaultMap(mapa){
			defaultDimensionsMaps(cantMapas);
			cMapController.getMapActive().getMap().updateSize();
		}
		function animateToMaxMap(mapa){
			$j(mapa).css({
				"left":"0px",
				"top":"0px"
			});
			$j(mapa).animate({
				"width":$j("#gMapMainContent").width()-20,
				"height":$j(window).height()-90
			},function() {
				cMapController.getMapActive().getMap().updateSize();
			 });
		}
		function MaximizarMapa(){
			$j('#btnMaxMinMap').removeAttr("onclick");
			for(var i=0; i < cMapController.getMaps().length; i++){
				if(cMapController.getActive() != i ){
					var divContentMap = document.getElementById(cMapController.getMapById(i).getDivContent());
					divContentMap.style.display = "none";
				}
			}
			animateToMaxMap("#"+cMapController.getMapActive().getDivContent());
		}
		
		function MaxMinMaps(){
			if($j("#"+cMapController.getMapActive().getDivContent()).width() != $j('#gMapMainContent').width()-20 ){
				for(var i=0; i < cMapController.getMaps().length; i++){
					if(cMapController.getActive()!= i ){
						var divContentMap = document.getElementById(cMapController.getMapById(i).getDivContent());
						divContentMap.style.display = "none";
					}
				}
				animateToMaxMap("#"+cMapController.getMapActive().getDivContent());
			}else{
				for(var i=0; i < cMapController.getMaps().length; i++){
					if(cMapController.getActive() != i){
						var divContentMap = document.getElementById(cMapController.getMapById(i).getDivContent());
						divContentMap.style.display = "block";
					}
				}
				animateToDefaultMap("#"+cMapController.getMapActive().getDivContent());
			}
		}
		
		function AlinearMapas(){
			if($j("#mapsAlign").val() == 1){
				$j("#mapsAlign").val(2);
				animateToDefaultMap();
			}else{
				$j("#mapsAlign").val(1);
				animateToDefaultMap();
			}
		}

		function clickMap2(id){
			//alert('id ' + id);
			indiceMapaActivo = id;
			cMapController.setActive(id);
			refreshMovilSelection();
			refreshMovilSeguimiento();
			printTableMisVehiculos();
			if (LOGIN.objetivoDB == 5){
				printTableMisFijos();
			}
			$j('#map'+id).addClass("my_CSS3_id");
			$j('#nroMap'+id).addClass("color-divNroMap");
			for(var i=0; i < cMapController.getMaps().length; i++){
				if(i != id){
					$j('#map'+i).removeClass("my_CSS3_id");
					$j('#nroMap'+i).removeClass("color-divNroMap");
				}
			}
		}

		function initialMap(id){
			refreshMapMainContent();
			var widthMapContent = $j('#gMapMainContent').width();
			var heightMapMenuBar = $j('#gMapMenuBar').height();
			$j("#TableroContainerMonitorDiv").css("width",widthMapContent);
			$j("#TableroContainerMonitorDiv").css("top","70%");
			$j("#gMapMainContent").css("height",heightMapMenuBar+3);

			indiceMapaActivo = id;
			cMapController.setActive(id);
			$j('#map'+id).addClass("my_CSS3_id");
			$j('#nroMap'+id).addClass("color-divNroMap");
			for(var i=0; i < 6; i++){
				if(i != id){
					$j('#map'+i).removeClass("my_CSS3_id");
					$j('#nroMap'+i).removeClass("color-divNroMap");
				}
			}
		}

		$j(function() {
			//$j('#btnMaxMinMap').click(function(){ MaximizarMapa();});
			//$j("#sortable").sortable({items: "> li:not(:last)"});
			$j("#sortable").sortable();
			$j("#sortable").disableSelection();
			//$j("#map").resizable();
			for(var x=0; x < cantMAXMaps ; x++){
				dblClickMap(x);
				clickMap(x);
			}
			function dblClickMap(m){
				$j('#nroMap'+m).dblclick(function (e) {
					indiceMapaActivo = m;
					cMapController.setActive(m);
					refreshMovilSelection();
					refreshMovilSeguimiento();
					printTableMisVehiculos();
					if($j('#map'+m).width() != $j('#gMapMainContent').width()-20 ){
						for(var i=0; i < cMapController.getMaps().length; i++){
							if(m != i ){
								var divContentMap = document.getElementById(cMapController.getMapById(i).getDivContent());
								divContentMap.style.display = "none";
							}
						}
						//$j('#map').width($j("#gMapMainContent").width());$j('#map').height($j(window).height()-60);//var pos = $j('#map').position(); //  $j("#sortable").sortable("cancel");
						animateToMaxMap("#map"+m);
					}else{
						for(var i=0; i < cMapController.getMaps().length; i++){
							if(m != i){
								var divContentMap = document.getElementById(cMapController.getMapById(i).getDivContent());
								divContentMap.style.display = "block";
							}
						}
						animateToDefaultMap("#map"+m);
			            //$j("#sortable").sortable("refreshPositions");
					}
				});
			}
			function clickMap(id){
				$j('#map'+id).click(function (e) {
					cMapController.getMapActive().getHistorico().initFiltrosGral();
					setFiltroHistoricoByMap(cMapController.getMapActive());//seteo sobre el mapa activo los valores que tiene en el historico
					setFiltroEventoByMap(cMapController.getMapActive());//seteo sobre el mapa activo los valores que tiene en el filtro de eventos
					setFiltroParadasByMap(cMapController.getMapActive());//seteo sobre el mapa activo los valores que tiene en el filtro de paradas

					cMapController.getMapActive().setMenuOpcion(AccordionMenu.getCurrentPanelIndex());//guardo que tab del menu esta activo
					cMapController.getMapActive().removeHighlightCircle();
					if(id != cMapController.getActive() && window.mostrarFiltroHistorico){
						mostrarFiltroHistorico();
					}
					if(id != cMapController.getActive() && cMapController.getMapActive().getModoABMPuntos()){
						if (document.getElementById('puntoIdHID').value=='')
							cleanEstadoNuevoPunto();
						else
							cleanEstadoModificarPunto();
						cleanEstadoNuevoGrupo();
					}
					if(id != cMapController.getActive() && cMapController.getMapActive().getModoABMZonas()){
						cMapController.getMapActive().cleanEstadoNuevaZona();
					}
					indiceMapaAnterior 	= cMapController.getActive();
					indiceMapaActivo 	= id;
					cMapController.setActive(id);//seteo el mapa que hice click como activo

					if(indiceMapaAnterior != cMapController.getActive()){
						if(cMapController.getMapActive().getTienePuntosTemp()){//si tiene puntos temporales muestro el listado sino muestro las referencias
							miscelaneasChargeSection(1);
							cMapController.getMapActive().printTableGestorDir();
						}else{
							miscelaneasChargeSection(0);
						}
					}
					getFiltroHistoricoByMap(cMapController.getMapActive());//traigo los valores del historico que tiene el mapa guardado y actualizo los filtros


					if(!cMapController.getMapActive().getHistorico().getInitFiltrosRecorrido()){//me fijo si inicialize los filtros
						if(window.CargarHistorico){//si existe la funcion (osea que cargue historico.js)
							CargarHistorico();
							cMapController.getMapActive().getHistorico().setInitFiltrosRecorrido(true);//seteo en true para despues no volver a llamar a CargarHistorico()
						}
					}
					AccordionMenu.openPanelNumber(cMapController.getMapActive().getMenuOpcion());//abro el tab del menu que tenia guardado
					$j("#gMapMenuBar").css("background",cMapController.getMapActive().getColorMenu());
					refreshMovilSelection();
					refreshMovilSeguimiento();
					refreshButtonSeguimientoEstela(cMapController.getMapActive().getEstelaSeguimientoActive(),cMapController.getMapActive().getBTNestelaSeguimiento());
					printTableMisVehiculos();
					printTableMisPuntos();
					if (LOGIN.objetivoDB == 5){
						printTableMisFijos();
					}
					cMapController.getMapActive().printTableMisZonas();
					$j('#map'+id).addClass("my_CSS3_id");
					$j('#nroMap'+id).addClass("color-divNroMap");
					for(var i=0; i < cMapController.getMaps().length; i++){
						if(i != id){
							$j('#map'+i).removeClass("my_CSS3_id");
							$j('#nroMap'+i).removeClass("color-divNroMap");
						}
					}
				});
			}

		});

////////////////////MONITOR/////////////////////////////////////////////////////
		var monitorVisible = true;
		function collapseMonitor(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (monitorVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconOut';
				$j('#monitor_content').css("display","none");
				$j('#monitorMenu').css("top","99%");
				$j('#monitorMenu').css("height","");
				$j('#monitorMenu').css("width",widthMapContent+7);
				monitorVisible = false;
				}
			else{
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconIn';
				$j('#monitor_content').css("display", "block");
				$j('#monitorMenu').css("top","65%");
				$j('#monitorMenu').css("height","300px");
				$j('#monitorMenu').css("width",widthMapContent+7);
				monitorVisible = true;
			}
		}
		function refreshMonitor(){
			$j('#monitorMenu').css("width",$j('#gMapMainContent').width()+7);
		}
		function refreshTablero(){
			$j("#TableroContainerMonitorDiv").css("width",$j('#gMapMainContent').width()+5);
		}
		function closeMonitor(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (monitorVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconOut';
				$j('#monitor_content').css("display","none");
				$j('#monitorMenu').css("top","99%");
				$j('#monitorMenu').css("height","");
				$j('#monitorMenu').css("width",widthMapContent+7);
				monitorVisible = false;
			}
		}
		function maxMonitor(){
			var widthMapContent = $j('#gMapMainContent').width();
			var heigthMapContent= $j('#gMapMainContent').height();
			var topMapContent	= $j('#gMapMainContent').position().top;
			if (monitorVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconIn';
				$j('#monitorMenu').css("top",topMapContent);
				$j('#monitorMenu').css("width",widthMapContent+7);
				$j('#monitorListScroll').css("height",heigthMapContent);
			}
		}
		function minMonitor(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (monitorVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconIn';
				$j('#monitorMenu').css("top","65%");
				$j('#monitorMenu').css("width",widthMapContent+7);
				$j('#monitorListScroll').css("height","300px");
			}
		}
///////////////////////////////////////////////////////////////////////////////
////////////////REPORTES///////////////////////////////////////////////////////
		var reportesVisible = false;
		function collapseReportes(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (reportesVisible){
				document.getElementById('sliceReportesIcon').className = 'sliceReportesIconOut';
				$j('#reportes_content').css("display","none");
				$j('#reportesMenu').css("top","100%");
				$j('#reportesMenu').css("height","");
				$j('#reportesMenu').css("width",widthMapContent+7);
				reportesVisible = false;
			}else{
				document.getElementById('sliceMonitorIcon').className = 'sliceReportesIconIn';
				$j('#reportes_content').css("display", "block");
				$j('#reportesMenu').css("top","65%");
				$j('#reportesMenu').css("height","300px");
				$j('#reportesMenu').css("width",widthMapContent+7);
				reportesVisible = true;
			}
		}
		function closeReportes(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (reportesVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconOut';
				$j('#monitor_content').css("display","none");
				$j('#reportesMenu').css("top","100%");
				$j('#reportesMenu').css("height","");
				$j('#reportesMenu').css("width",widthMapContent+7);
				reportesVisible = false;
			}
		}
		function maxReportes(){
			var widthMapContent = $j('#gMapMainContent').width();
			var heigthMapContent= $j('#gMapMainContent').height();
			var topMapContent	= $j('#gMapMainContent').position().top;
			if (reportesVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconIn';
				$j('#reportesMenu').css("top",topMapContent);
				$j('#reportesMenu').css("width",widthMapContent+7);
				$j('#ReportesListScroll').css("height",heigthMapContent);
			}
		}
		function minReportes(){
			var widthMapContent = $j('#gMapMainContent').width();
			if (reportesVisible){
				document.getElementById('sliceMonitorIcon').className = 'sliceMonitorIconIn';
				$j('#reportesMenu').css("top","65%");
				$j('#reportesMenu').css("width",widthMapContent+7);
				$j('#ReportesListScroll').css("height","300px");
			}
		}
///////////////////////////////////////////////////////////////////////////////
		 $j(window).resize(function () {
			 refreshMapMainContent();
			 var widthMapContent = $j('#gMapMainContent').width();
			 var heightMapMenuBar = $j('#gMapMenuBar').height();
			 $j('#monitorMenu').css("width",widthMapContent+7);
			 $j('#reportesMenu').css("width",widthMapContent+7);
			 $j("#TableroContainerMonitorDiv").css("width",widthMapContent+5);
			 $j("#TableroContainerMonitorDiv").css("top",heightMapMenuBar-270+68);
			 $j("#gMapMainContent").css("height",heightMapMenuBar+3);
		 });

		 function closeMap(nroMap){
			var divContentMap = document.getElementById(cMapController.getMapById(nroMap).getDivContent());
			divContentMap.style.display = "none";
			cantMapas--;
			setearImagenFromCantidadMapas();
			animateToDefaultMap();
		 }

		 function cambiarCursor(cursor){
			 switch(cursor){
			 case 1: document.body.style.cursor = "auto"; break;
			 case 2: document.body.style.cursor = "pointer"; break;
			 default : document.body.style.cursor = "auto"; break;
			 }

		 }
			var tab_counter = 2;
		   $j(document).ready(function() {
				 	//$j('#tabs').tabs();
				 	
		            $j('#tabs a.tab').live('click', function() {
		                // Get the tab name
		                var contentname = $j(this).attr("id") + "_content";

		                // hide all other tabs
		                $j("#content .divContenedor").hide();
		                $j("#tabs li").removeClass("current");

		                // show current tab
		                $j("#" + contentname).show();
		                $j(this).parent().addClass("current");
		            });

		            $j('#tabs a.remove').live('click', function() {
		                // Get the tab name
		                var tabid = $j(this).parent().find(".tab").attr("id");
					
		                // remove tab and related content
		                var contentname = tabid + "_content";
		                $j("#" + contentname).remove();
		                $j(this).parent().remove();

		                // if there is no current tab and if there are still tabs left, show the first one
		                if ($j("#tabs li.current").length == 0 && $j("#tabs li").length > 0) {

		                    // find the first tab    
		                    var firsttab = $j("#tabs li:first-child");
		                    firsttab.addClass("current");

		                    // get its link name and show related content
		                    var firsttabid = $j(firsttab).find("a.tab").attr("id");
		                    $j("#" + firsttabid + "_content").show();
		                }
		            });
		        });
					
		      function addTab(link,html) {
		    		var tab_title = link || 'Tab '+tab_counter;
		    		 
		            // If tab already exist in the list, return
		            /*if ($j("#" + tab_title).length != 0){
		        	   $j("#" + tab_title + "_content").html(html);
			           return;
		           	}*/
		            // hide other tabs
		            $j("#tabs li").removeClass("current");
		            $j("#content .divContenedor").hide();
		            
		            // add new tab and related content
		            $j("#tabs").append('<li class="current ui-state-default ui-corner-top "><a class="tab" id="'+tab_title+tab_counter+'" href="#">'+tab_title+'</a><a href="#" class="remove ui-icon ui-icon-close">x</a></li>');

		            $j("#content").append("<div id='" + tab_title + tab_counter+"_content' class='divContenedor ui-tabs-panel ui-widget-content ui-corner-bottom'>" + html + "</div>");
		            
		            // set the newly added tab as current
		            $j("#" + tab_title + tab_counter+"_content").show();
		            tab_counter++;
		            if (!reportesVisible){
		            	collapseReportes();
		            }
		        }
					
	</script>
	<div id="gMapMainContent" style="overflow:scroll;">
    	<ul id="sortable">
    		<?php
    		for($i=0;$i<6;$i++){
    			$j=$i+1;
    		?>
				<li class="ui-state-default" id="map<?=$i?>" >
				<div id="nroMap<?=$i?>">
					<span id="textNro<?=$i?>"><?=$j?></span>
					<div align="right" style="float: right;"><img onmouseover="cambiarCursor(2);" alt="cerrar" src="images/close.gif" onclick="closeMap(<?=$i?>);"></div>
					<div align="right" style="float: right;"><img onmouseover="cambiarCursor(2);" width="18px" height="17px" alt="cerrar" src="images/guardar.png" onclick="guardarMap(<?=$i?>);"></div>
				</div>
					<div id="map_canvas<?=$i?>" oncontextmenu="return false;"></div>
				</li>
			<?php
    		}?>
    	</ul>

    </div>
 	  <div id="TableroContainerMonitorDiv" class="Tablero tablero-general" unselectable="on">
		<div class="TableroContainer-header"><div class="TableroContainer-button-div">
		<span class="TableroContainer-button" title="Cerrar el tablero" style="cursor: pointer;" onclick="closeTablero();">[x]&nbsp;</span></div>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tbody>
		<tr>
		<td><div class="TableroLateral" style="height: 250px;"></div></td>
		<td width="680px"><div class="TableroContainer" style="height: 250px;">
			<div class="TableroContainer-container" style="height: 100%; overflow: hidden;">
				<div style="display: block; width: 100%; text-align: center; overflow: hidden;" id="tablero_content">
				   <table align="center" width="680" cellspacing="0" cellpadding="0" border="0">
				   	  <tr>
				        <td colspan="5">&nbsp;</td>
				      </tr>
					  <tr>
				        <td>&nbsp;</td>
				        <td>&nbsp;</td>
				        <td rowspan="3" id="posVelocimetro" valign="middle" align="center" width="190"></td>
				        <td>&nbsp;</td>
				        <td>&nbsp;</td>
				      </tr>
				      <tr>
				        <td rowspan="2" id="posFuelandtemp" valign="middle" align="center" width="120"></td>
				        <td id="posRpm" valign="middle" align="center" width="120"></td>
				        <td id="posBrujula" valign="middle" align="center" width="110"></td>
				        <td rowspan="2" id="posVoltimetro" valign="middle" align="center"></td>
				      </tr>
				      <tr>
				        <td rowspan="2" id="posIndGral" valign="middle" align="center"></td>
				        <td rowspan="2" id="posPuertas" valign="middle" align="center"></td>
				      </tr>
				      <tr>
				        <td style="font-family:arial;font-size:9px;color:#828282;">Odometro parcial</td>
				        <td>&nbsp;</td>
				        <td style="font-family:arial;font-size:9px;color:#828282;" align="center">Odometro total</td>
				      </tr>
				      <tr>
				        <td id='posOdometroParcial' valign="middle" align="center"></td>
				        <td colspan="3" valign="middle" align="center">
				        	<table cellpadding="0" cellspacing="0" border="0">
				            	<tr>
				                	<td id='posDisplayTablero' valign="middle" align="center"></td>
				                    <td valign="middle" align="left">
				                    	&nbsp;
				                    	<img src="js/tablero/images/BTNseguir.gif" border="1" onclick="seguirTablero();" onmouseover="this.border=0;" onmouseout="this.border=1;" title="Seguir el movil del tablero" border="0" style="cursor:pointer;"/>
				                        <img src="js/tablero/images/BTNcentrar.gif" onclick="centrarTablero();" title="Centrar el mapa en el movil del tablero" border="1" onmouseover="this.border=0;" onmouseout="this.border=1;" style="cursor:pointer;"/>
				                    </td>
				                </tr>
				            </table>
				        </td>
				        <td id='posOdometroTotal' valign="middle" align="center"></td>
				      </tr>
				   </table>
			</div>
   	 	</div>
   	 	</div></td><td><div class="TableroLateral" style=" height: 250px;"></div></td></tr></tbody></table>
   	 	</div>

   	 <div style="clear: both;top:99%;opacity:0.9;position:absolute;z-index:1020;" id="monitorMenu">
    	<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
    	<tr>
	    	<td width="10" valign="middle" bgcolor="#ffc0c0" align="center" onclick="collapseMonitor();" style="background: url(&quot;images/collapsableBarBG.gif&quot;) repeat-y scroll 0% 0% rgb(227, 227, 227); cursor: pointer;">
	        	<div class="sliceMonitorIconIn" id="sliceMonitorIcon">
	        </td>
        </tr>
        <tr>
	        <td>
	        <div class="OpenContainer-header" style="text-align: left;">
	     	   <div class="OpenContainer-image"><span class="OpenContainer-title">Monitor</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="closeMonitor();">[x]&nbsp;</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="maxMonitor();">[+]&nbsp;&nbsp;</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="minMonitor();">[-]&nbsp;&nbsp;</span></div>
	        </div>
	        <div class="OpenContainer-container" style="height: 100%; overflow: hidden;">
	        	<div id="monitor_content" style="display:none; overflow:hidden;" align="center">
						<div class="minimenu" id="minimenuMonitorContent" style="height: 34px">
					                <div class="buttonBar">
						            	<input type="button" class="BTNselectAll" onclick="checkAllOptions('boxEventos[]', true);" onmouseover="minimenuInfoSet('minimenuMonitorContent', 'Seleccionar todos los eventos');" onmouseout="minimenuInfoSet('minimenuMonitorContent', '');">
										<input type="button" class="BTNunselectAll" onclick="checkAllOptions('boxEventos[]', false);" onmouseover="minimenuInfoSet('minimenuMonitorContent', 'No seleccionar ningun evento');" onmouseout="minimenuInfoSet('minimenuMonitorContent', '');">
					                    <input type="button" class="BTNprocessAll" onclick="openPopUpLeerEventosSelected();" onmouseover="minimenuInfoSet('minimenuMonitorContent', 'Procesar todos los eventos seleccionados');" onmouseout="minimenuInfoSet('minimenuMonitorContent', '');">
					                    <input type="button" class="BTNcancel" onclick="clearEventosMonitorFromMap();" onmouseover="minimenuInfoSet('minimenuMonitorContent', 'Borrar todas las marcas de eventos del monitor impresas en el mapa');" onmouseout="minimenuInfoSet('minimenuMonitorContent', '');">
					                </div>
					                <div class="infoBar"></div>
					    </div>
						<div id="monitorListScroll" style="overflow:auto; width:100%; background:#E3E3E3; height:300px;">
					    	<div id="divMonitorList"></div>
					    </div>
				</div>
			<div>
	        </td>
        </tr>
        </table>
    </div>
 
 	 <div style="clear: both;top:100%;opacity:0.9;position:absolute;z-index:1021;" id="reportesMenu">
    	<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
    	<tr>
	    	<td width="10" valign="middle" bgcolor="#ffc0c0" align="center" onclick="collapseReportes();" style="background: url(&quot;images/collapsableBarBG.gif&quot;) repeat-y scroll 0% 0% rgb(227, 227, 227); cursor: pointer;">
	        	<div class="sliceReportesIconIn" id="sliceReportesIcon">
	        </td>
        </tr>
        <tr>
	        <td>
	        <div class="OpenContainer-header" style="text-align: left;">
	     	   <div class="OpenContainer-image"><span class="OpenContainer-title">Reportes</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="closeReportes();">[x]&nbsp;</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="maxReportes();">[+]&nbsp;&nbsp;</span></div>
		        <div class="OpenContainer-button-div"><span class="OpenContainer-button" style="cursor: pointer;" onclick="minReportes();">[-]&nbsp;&nbsp;</span></div>
	        </div>
	        <div class="OpenContainer-container" style="height: 100%; overflow: hidden;">
	        	<div id="reportes_content" style="display:none; overflow:hidden;" align="center">
						<div id="ReportesListScroll" style="overflow:auto; width:100%; background:#E3E3E3; height:300px;">
					    	<div id="divReportesList">
						    	<div class="reportesHistoricos">
									<div>
										 <ul id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
								            <!-- Tabs go here -->
								        </ul>
								        <div id="content">
								            <!-- Tab content goes here -->
								        </div>
									</div>
								</div><!-- End reportesHistoricos -->
					    	</div>
					    </div>
				</div>
			<div>
	        </td>
        </tr>
        </table>
    </div>
  </div>
  <script type="text/javascript">

	  function defaultDimensionsMaps(canti){
		  	var onlyMap = {
				"width":"99%",
				"height":"800px"
			};
		  	var twoMapsVert = {
				"width":"49%",
				"height":"800px"
			};
		  	var twoMapsHor = {
				"width":"99%",
				"height":"400px"
			};
		  	var quarterMaps = {
				"width":"49%",
				"height":"400px"
			};
		  	var onlyLowerHalfMaps = {
				"width":"99%",
				"height":"400px"
			};
		  	var thirdMaps = {
				"width":"32.5%",
				"height":"400px"
			};

			switch(canti){
			case 1:
				//$j('#map').addClass("oneMap");
				$j('#map0').css(onlyMap);
				break;
			case 2:
				if($j("#mapsAlign").val() == 1){
					$j('#map0').css(twoMapsHor);
					$j('#map1').css(twoMapsHor);
				}else{
					$j('#map0').css(twoMapsVert);
					$j('#map1').css(twoMapsVert);
				}
				break;
			case 3:
				if($j("#mapsAlign").val() == 1){
					$j('#map0').css(quarterMaps);
					$j('#map1').css(quarterMaps);
					$j('#map2').css(onlyLowerHalfMaps);
				}else{
					$j('#map0').css(onlyLowerHalfMaps);
					$j('#map1').css(quarterMaps);
					$j('#map2').css(quarterMaps);
				}
				break;
			case 4:
				$j('#map0').css(quarterMaps);
				$j('#map1').css(quarterMaps);
				$j('#map2').css(quarterMaps);
				$j('#map3').css(quarterMaps);
				break;
			case 5:
				if($j("#mapsAlign").val() == 1){
					$j('#map0').css(thirdMaps);
					$j('#map1').css(thirdMaps);
					$j('#map2').css(thirdMaps);
					$j('#map3').css(quarterMaps);
					$j('#map4').css(quarterMaps);
				}else{
					$j('#map0').css(quarterMaps);
					$j('#map1').css(quarterMaps);
					$j('#map2').css(thirdMaps);
					$j('#map3').css(thirdMaps);
					$j('#map4').css(thirdMaps);
				}
				break;
			case 6:
				$j('#map0').css(thirdMaps);
				$j('#map1').css(thirdMaps);
				$j('#map2').css(thirdMaps);
				$j('#map3').css(thirdMaps);
				$j('#map4').css(thirdMaps);
				$j('#map5').css(thirdMaps);
				break;
			}
	  }
	  defaultDimensionsMaps(cantMapas);
  </script>

<?php
	// include ('MAPS/'.$_GET['mapType'].'/initialize.php');
      $fecha=mktime(0,0,0,1,1,2010);
     // setcookie('wcMapType',$_GET['mapType'],' ',' ',0);?> <!-- incluye todas las funciones ...Body() para el mapa en cuestion -->
<script>
	var mapOptions;
	var projection; //proyeccion del mapa
	var displayProjection; //proyeccion del display
	var monitorButton = null;
	var tableroContainer = null;
	function loadlibraries(){
		document.getElementById('mapLoadingPanel').style.display = "block";
		dinamicIncludes_Map.includePreload();
	}

	function initialize() {
	  	//dinamicIncludes_Map.includeGeneral();
		cMapController = new cMapController();
		for(var n=0; n < cantMapas; n++){
			cMapController.addMap(new cMapa());
		}
	   	cMapController.setActive(0);
	  	cMapController.getMapActive().setCuentaSeguimiento(<?="'".$_GET['cuentaSelectSegui']."'"?>);
		cMapController.getMapActive().setSeleccionActual("-1");
		<? if (isset($_GET['cuentaSelectSelection'])) {?>
			cMapController.getMapActive().setSeleccionActual(<?="'".$_GET['cuentaSelectSelection']."'"?>);
		<? } ?>;
		MOVILES_VISIBLES = cMapController.getMapActive().getCuentaSeguimiento();
		<?php if (isset($_GET['movilesVISIBLES'])) {?>
			MOVILES_VISIBLES = <?="'".$_GET['movilesVISIBLES']."'"?> ;
		<?php } ?>;

		<?php 
			 if ($LOGIN->objetivoDB == 5){?>
				FIJOS_VISIBLES = <?="'".$_GET['cuentaSelectSegui']."'"?>
		<?php }
		?>

	  	document.getElementById("busyImg").style.visibility = "hidden";
	  	AccordionMenu = new Spry.Widget.Accordion("AccordionMenu");

		cMapController.initMaps();
		mapServersList = vMAPAS_DISPONIBLES.split(",");
		//Controles OpenLayers
		for(var i=0;i<cantMapas;i++){
			cMapController.getMapById(i).initServers(i);
			cMapController.getMapById(i).initControls(i);
			cMapController.getMapById(i).setLonLat(new OpenLayers.LonLat(parseFloat(<?=$_GET['y']?>), parseFloat(<?=$_GET['x']?>)).transform(cMapController.getMapById(i).getDisplayProjection(), cMapController.getMapById(i).getProjection()));
			cMapController.getMapById(i).getMap().setCenter(cMapController.getMapById(i).getLonLat(), cMapController.getMapById(i).getZoomInitialMap());
		}
		for(var i=cantMapas;i<6;i++){
			$j("#map"+i).css("display","none");
		}

		dinamicIncludes_Map.setMessage('Cargando MOVILES...');
		CargarMisGruposVehiculos();
		if (LOGIN.objetivoDB == 5){
			CargarMisFijos();
		}
		//-------------------------------------
		vehiculosCargadosFlag  = true;
        RefreshForm();
		cMapController.initMapEvents();
		resizear();
		setInterval("AutoRefreshForm();", eval(<?= GMAP_MAPA_REFRESH_AVL ?>) * 1000);
		jscolor.init();
		initialMap(0);
		collapseMonitor();
    }

	 function handleMeasurements(event) {
            var geometry = event.geometry;
            var units = event.units;
            var order = event.order;
            var measure = event.measure;
            var out = "";
            if(order == 1) {
                out += "measure: " + measure.toFixed(3) + " " + units;
            } else {
                out += "measure: " + measure.toFixed(3) + " " + units + "<sup>2</" + "sup>";
            }
        }

	function unload(){
		//unloadBody();
	}

    function cleanAllStates(){
		if (LOGIN.PERMISOS[0])
			cleanEstadoNuevoGrupoVehiculos();
		if ((LOGIN.PERMISOS[7])&&(dinamicIncludes_Map.isMisPuntosInclude())){
    		cleanEstadoNuevoPunto();
	    	cleanEstadoModificarPunto();
    		cleanEstadoBuscarPunto();
    		cleanEstadoNuevoGrupo();
			}
		if ((LOGIN.PERMISOS[8])&&(dinamicIncludes_Map.isMisZonasInclude()))
			cMapController.getMapActive().cleanEstadoNuevaZona();
		if ((LOGIN.PERMISOS[9])&&(dinamicIncludes_Map.isLogisticaInclude())){
    		cleanEstadoNuevaRegla();
    		cleanEstadoAplicarRegla();
			}
    }
    function resizear() {
    	var theHeight = 0;
    	if (window.innerHeight) {
    		theHeight=window.innerHeight;
    	}
    	else if (document.documentElement && document.documentElement.clientHeight) {
    		theHeight=document.documentElement.clientHeight;
    	}
    	else if (document.body) {
    		theHeight=document.body.clientHeight;
    	}
    	if (theHeight > 590){
    		mapHeight = theHeight - 90;
    	}
    	else {
    		mapHeight = 500;
    	}

		document.getElementById('gMapMenuBar').style.height = mapHeight + "px";
		document.getElementById('mapLoadingPanel').style.height = theHeight + 'px';

	/*	if (dinamicIncludes_Map.isGeneralInclude()){
			for(var i=0;i<cantMapas;i++){
				if(vMaps[i].getMap() != null){
					vMaps[i].getMap().updateSize();
				}
				if (vMonitorButton[i] != null)
					vMonitorButton[i].redraw();
				if (vTableroContainer[i] != null)
					vTableroContainer[i].redraw();
			}
		}
	*/
    }


	function initializeGlobalVars(){
		LOGIN = jQuery.parseJSON('<?= $loginJSON ?>');
		mapCanvas = document.getElementById('map_canvas0');
		inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
		OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
	    OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
    	OpenLayers.DOTS_PER_INCH = 96;
		mapIcons = new MapIcons({
						misPuntos: LOGIN.PERMISOS[4]
					});
	}

	var _loadingBar = new ProgressBar({
								width: '150px',
     							container: 'mapLoadingBar'
     						  });

</script>
</body>
</html>